home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5409 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  894 b 

  1. Path: news.drexel.edu!dunx1!st918h5w
  2. From: st918h5w@dunx1.ocs.drexel.edu (Jonathan Juniman)
  3. Newsgroups: comp.lang.c++
  4. Subject: ? about declaration
  5. Date: 4 Feb 1996 13:40:43 GMT
  6. Organization: Drexel University
  7. Message-ID: <4f2d0r$paq@noc2.drexel.edu>
  8. NNTP-Posting-Host: dunx1.ocs.drexel.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I am confused about something; I have been trying to declare new variables 
  12. inside of an if statement:
  13.  
  14. aClass::SomeFunction
  15.     {
  16.     aClass i();
  17.  
  18.     if(SomeCondition == TRUE)
  19.         {
  20.         aClass j();
  21.         }
  22.     }
  23.  
  24. Some compilers will let me do this, others will not.  I was under the
  25. impression that C++ always lets you do this, so that you don't have
  26. to allocate stack space for j unless SomeCondition is true.  Can
  27. someone straighten me out about what the standard is, or if there is
  28. none at all and this sort of thing is compiler dependent?  Please reply by
  29. mail.
  30.                     Thanks, -Jon 
  31.